//--------------------------------------- NOTES ------------------------------------------------------//
* This table is Table A2 in the paper
//--------------------------------------------------------------------------------------------------------//

cd  "/YOUR_LOCAL_DIRECTORY" //setting the working directory
clear all //remove all data, labels, matrices etc (incl. Mata functions)
use August17ChanRoth.dta, clear

** drop player who participated mulitple times
drop if room=="HRSUs" | room=="FQkZh"

* Create the key treatment variable
gen byte status_quo = treatment=="status_quo"
la var status_quo  "Status Quo"

* Create Y variable
gen deaths =.
gen mortalitylow = 1 if drawn_low=="red"
replace mortalitylow=0 if drawn_low=="blue"
gen mortalityhigh = 1 if drawn_high=="red"
replace mortalityhigh=0 if drawn_high=="blue"
replace deaths= mortalitylow+ mortalityhigh
gen mortality = deaths/2

* Make table

eststo clear

eststo: quietly reg mortality status_quo if player2highbluecount>=90 | player2lowbluecount<=10,  vce(cluster room) // Compare mortality rate by treatment group
eststo: quietly reg mortality status_quo player1bluecount player2highbluecount player2lowbluecount if player2highbluecount>=90 | player2lowbluecount<=10,  vce(cluster room) // Compare mortality rate by treatment group
*eststo: quietly reg mortality status_quo player1bluecount player2highbluecount player2lowbluecount i.round if player2highbluecount>=90 | player2lowbluecount<=10,  vce(cluster room) // Compare mortality rate by treatment group

eststo: quietly reg mortalitylow status_quo if player2lowbluecount<=10,  vce(cluster room) // Compare mortality rate by treatment group
eststo: quietly reg mortalitylow status_quo player1bluecount player2highbluecount player2lowbluecount if player2lowbluecount<=10,  vce(cluster room) // Compare mortality rate by treatment group
*eststo: quietly reg mortalitylow status_quo player1bluecount player2highbluecount player2lowbluecount i.round if player2lowbluecount<=10,  vce(cluster room) // Compare mortality rate by treatment group

eststo: quietly reg mortalityhigh status_quo if player2highbluecount>=90,  vce(cluster room) // Compare mortality rate by treatment group
eststo: quietly reg mortalityhigh status_quo player1bluecount player2highbluecount player2lowbluecount if player2highbluecount>=90,  vce(cluster room) // Compare mortality rate by treatment group
*eststo: quietly reg mortalityhigh status_quo player1bluecount player2highbluecount player2lowbluecount i.round if player2highbluecount>=90,  vce(cluster room) // Compare mortality rate by treatment group

label variable player1bluecount "Jar \# Blue Balls"
label variable player2highbluecount "High Urn \# Blue Balls"
label variable player2lowbluecount "Low Urn \# Blue Balls"

local numbers "& (1) & (2) & (3) & (4) & (5) & (6) \\ \hline"

esttab using table_mortality_extremes_a2.tex, se r2  keep(status_quo player1bluecount player2highbluecount player2lowbluecount _cons) star(+ 0.1 * 0.05 ** 0.01) b(3) mgroups("\shortstack[c]{\% Red Balls for \\ All Urns when One Urn \\ is Healthiest or Sickest}" "\% Red Balls for Sickest Urns" "\% Red Balls for Healthiest Urns", pattern(1 0 1 0 1) prefix(\multicolumn{2}{c}{) suffix(}) span) mlabels(none) nonumbers posthead("`numbers'") label title("Impact on Bad Outcomes (Red Balls Drawn) for the 'Healthiest' (Urns with \(\geq\) 90\% Blue Balls) and 'Sickest' (Urns with \(\leq\) 10\% Blue Balls)") substitute([htbp] [!htbp] \begin{tabular} \small\begin{tabular} {l} {p{\linewidth}}) addnotes("(Robust, clustered by player-pairings)") stat(N r2, label("N" "\[R^2\]") fmt(a3 %9.3fc))
